home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / Mesa-1.2.1 / include / glaux.h next >
Encoding:
C/C++ Source or Header  |  1995-07-05  |  6.9 KB  |  303 lines

  1. /* glaux.h */
  2.  
  3. /*
  4.  * Mesa - a 3-D graphics library
  5.  * Version:  1.0 beta
  6.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * This code originated from SGI and was modified for use with Mesa.
  26.  */
  27.  
  28.  
  29. #ifndef AUX_INCLUDED
  30. #define AUX_INCLUDED
  31.  
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37.  
  38. #if !defined(AMIGA) && !defined(__WIN32__)
  39. #  include <X11/Xlib.h>
  40. #  include <X11/Xutil.h>
  41. #endif
  42. #include <GL/gl.h>
  43. #include <GL/glu.h>
  44.  
  45. /*
  46. ** ToolKit Window Types
  47. ** In the future, AUX_RGBA may be a combination of both RGB and ALPHA
  48. */
  49.  
  50. #define AUX_RGB        0
  51. #define AUX_RGBA    AUX_RGB
  52. #define AUX_INDEX    1
  53. #define AUX_SINGLE    0
  54. #define AUX_DOUBLE    2
  55. #define AUX_DIRECT    0
  56. #define AUX_INDIRECT    4
  57.  
  58. #define AUX_ACCUM    8
  59. #define AUX_ALPHA    16
  60. #define AUX_DEPTH    32
  61. #define AUX_STENCIL    64
  62. #define AUX_AUX        128
  63.  
  64. /* 
  65. ** Window Masks
  66. */
  67.  
  68. #define AUX_WIND_IS_RGB(x)    (((x) & AUX_INDEX) == 0)
  69. #define AUX_WIND_IS_INDEX(x)    (((x) & AUX_INDEX) != 0)
  70. #define AUX_WIND_IS_SINGLE(x)    (((x) & AUX_DOUBLE) == 0)
  71. #define AUX_WIND_IS_DOUBLE(x)    (((x) & AUX_DOUBLE) != 0)
  72. #define AUX_WIND_IS_INDIRECT(x)    (((x) & AUX_INDIRECT) != 0)
  73. #define AUX_WIND_IS_DIRECT(x)    (((x) & AUX_INDIRECT) == 0)
  74. #define AUX_WIND_HAS_ACCUM(x)    (((x) & AUX_ACCUM) != 0)
  75. #define AUX_WIND_HAS_ALPHA(x)    (((x) & AUX_ALPHA) != 0)
  76. #define AUX_WIND_HAS_DEPTH(x)    (((x) & AUX_DEPTH) != 0)
  77. #define AUX_WIND_HAS_STENCIL(x)    (((x) & AUX_STENCIL) != 0)
  78.  
  79. /*
  80. ** ToolKit Event Structure
  81. */
  82.  
  83. typedef struct _AUX_EVENTREC {
  84.     GLint event;
  85.     GLint data[4];
  86. } AUX_EVENTREC;
  87.  
  88. /* 
  89. ** ToolKit Event Types
  90. */
  91. #define AUX_EXPOSE    1
  92. #define AUX_CONFIG    2
  93. #define AUX_DRAW    4
  94. #define AUX_KEYEVENT    8
  95. #define AUX_MOUSEDOWN    16
  96. #define AUX_MOUSEUP    32    
  97. #define AUX_MOUSELOC    64
  98.  
  99. /*
  100. ** Toolkit Event Data Indices
  101. */
  102. #define AUX_WINDOWX        0
  103. #define AUX_WINDOWY        1
  104. #define AUX_MOUSEX        0
  105. #define AUX_MOUSEY        1
  106. #define AUX_MOUSESTATUS        3
  107. #define AUX_KEY            0
  108. #define AUX_KEYSTATUS        1
  109.  
  110. /*
  111. ** ToolKit Event Status Messages
  112. */
  113. #define    AUX_LEFTBUTTON        1
  114. #define    AUX_RIGHTBUTTON        2
  115. #define    AUX_MIDDLEBUTTON    4
  116. #define    AUX_SHIFT        1
  117. #define    AUX_CONTROL        2
  118.  
  119. /* 
  120. ** ToolKit Key Codes
  121. */
  122. #define AUX_RETURN        0x0D
  123. #define AUX_ESCAPE        0x1B
  124. #define AUX_SPACE        0x20
  125. #define AUX_LEFT        0x25
  126. #define AUX_UP            0x26
  127. #define AUX_RIGHT        0x27
  128. #define AUX_DOWN        0x28
  129. #define AUX_A            'A'
  130. #define AUX_B            'B'
  131. #define AUX_C            'C'
  132. #define AUX_D            'D'
  133. #define AUX_E            'E'
  134. #define AUX_F            'F'
  135. #define AUX_G            'G'
  136. #define AUX_H            'H'
  137. #define AUX_I            'I'
  138. #define AUX_J            'J'
  139. #define AUX_K            'K'
  140. #define AUX_L            'L'
  141. #define AUX_M            'M'
  142. #define AUX_N            'N'
  143. #define AUX_O            'O'
  144. #define AUX_P            'P'
  145. #define AUX_Q            'Q'
  146. #define AUX_R            'R'
  147. #define AUX_S            'S'
  148. #define AUX_T            'T'
  149. #define AUX_U            'U'
  150. #define AUX_V            'V'
  151. #define AUX_W            'W'
  152. #define AUX_X            'X'
  153. #define AUX_Y            'Y'
  154. #define AUX_Z            'Z'
  155. #define AUX_a            'a'
  156. #define AUX_b            'b'
  157. #define AUX_c            'c'
  158. #define AUX_d            'd'
  159. #define AUX_e            'e'
  160. #define AUX_f            'f'
  161. #define AUX_g            'g'
  162. #define AUX_h            'h'
  163. #define AUX_i            'i'
  164. #define AUX_j            'j'
  165. #define AUX_k            'k'
  166. #define AUX_l            'l'
  167. #define AUX_m            'm'
  168. #define AUX_n            'n'
  169. #define AUX_o            'o'
  170. #define AUX_p            'p'
  171. #define AUX_q            'q'
  172. #define AUX_r            'r'
  173. #define AUX_s            's'
  174. #define AUX_t            't'
  175. #define AUX_u            'u'
  176. #define AUX_v            'v'
  177. #define AUX_w            'w'
  178. #define AUX_x            'x'
  179. #define AUX_y            'y'
  180. #define AUX_z            'z'
  181. #define AUX_0            '0'
  182. #define AUX_1            '1'
  183. #define AUX_2            '2'
  184. #define AUX_3            '3'
  185. #define AUX_4            '4'
  186. #define AUX_5            '5'
  187. #define AUX_6            '6'
  188. #define AUX_7            '7'
  189. #define AUX_8            '8'
  190. #define AUX_9            '9'
  191.  
  192. /*
  193. ** ToolKit Gets and Sets
  194. */
  195. #define AUX_FD            1  /* return fd (long) */
  196. #define AUX_COLORMAP        3  /* pass buf of r, g and b (unsigned char) */
  197. #define AUX_GREYSCALEMAP    4
  198. #define AUX_FOGMAP        5  /* pass fog and color bits (long) */
  199. #define AUX_ONECOLOR        6  /* pass index, r, g, and b (long) */
  200.  
  201. /*
  202. ** Color Macros
  203. */
  204.  
  205. enum {
  206.     AUX_BLACK = 0,
  207. #ifdef __WIN32__
  208.     AUX_RED=10,
  209. #else
  210.     AUX_RED,
  211. #endif
  212.     AUX_GREEN,
  213.     AUX_YELLOW,
  214.     AUX_BLUE,
  215.     AUX_MAGENTA,
  216.     AUX_CYAN,
  217.     AUX_WHITE
  218. };
  219.  
  220. #ifdef __WIN32__
  221.    extern float auxRGBMap[17][3];
  222. #else
  223.    extern float auxRGBMap[8][3];
  224. #endif
  225.  
  226. #define AUX_SETCOLOR(x, y) (AUX_WIND_IS_RGB((x)) ? \
  227.                    glColor3fv(auxRGBMap[(y)]) : glIndexf((y)))
  228.  
  229. /*
  230. ** RGB Image Structure
  231. */
  232.  
  233. typedef struct _AUX_RGBImageRec {
  234.     GLint sizeX, sizeY;
  235.     unsigned char *data;
  236. } AUX_RGBImageRec;
  237.  
  238. /*
  239. ** Prototypes
  240. */
  241.  
  242. extern void auxInitDisplayMode(GLenum);
  243. extern void auxInitPosition(int, int, int, int);
  244. extern GLenum auxInitWindow(char *);
  245. extern void auxCloseWindow(void);
  246. extern void auxQuit(void);
  247. extern void auxSwapBuffers(void);
  248.  
  249. #if !defined(AMIGA) && !defined(__WIN32__)
  250. extern Display *auxXDisplay(void);
  251. extern Window auxXWindow(void);
  252. #endif
  253.  
  254. extern void auxMainLoop(void (*)());
  255. extern void auxExposeFunc(void (*)(int, int));
  256. extern void auxReshapeFunc(void (*)(int, int));
  257. extern void auxIdleFunc(void (*)());
  258. extern void auxKeyFunc(int, void (*)());
  259. extern void auxMouseFunc(int, int, void (*)(AUX_EVENTREC *));
  260.  
  261. extern int auxGetColorMapSize(void);
  262. extern void auxGetMouseLoc(int *, int *);
  263. extern void auxSetOneColor(int, float, float, float);
  264. extern void auxSetFogRamp(int, int);
  265. extern void auxSetGreyRamp(void);
  266. extern void auxSetRGBMap(int, float *);
  267.  
  268. extern AUX_RGBImageRec *auxRGBImageLoad(char *);
  269.  
  270. extern void auxCreateFont(void);
  271. extern void auxDrawStr(char *);
  272.  
  273. extern void auxWireSphere(GLdouble);
  274. extern void auxSolidSphere(GLdouble);
  275. extern void auxWireCube(GLdouble);
  276. extern void auxSolidCube(GLdouble);
  277. extern void auxWireBox(GLdouble, GLdouble, GLdouble);
  278. extern void auxSolidBox(GLdouble, GLdouble, GLdouble);
  279. extern void auxWireTorus(GLdouble, GLdouble);
  280. extern void auxSolidTorus(GLdouble, GLdouble);
  281. extern void auxWireCylinder(GLdouble, GLdouble);
  282. extern void auxSolidCylinder(GLdouble, GLdouble);
  283. extern void auxWireIcosahedron(GLdouble);
  284. extern void auxSolidIcosahedron(GLdouble);
  285. extern void auxWireOctahedron(GLdouble);
  286. extern void auxSolidOctahedron(GLdouble);
  287. extern void auxWireTetrahedron(GLdouble);
  288. extern void auxSolidTetrahedron(GLdouble);
  289. extern void auxWireDodecahedron(GLdouble);
  290. extern void auxSolidDodecahedron(GLdouble);
  291. extern void auxWireCone(GLdouble, GLdouble);
  292. extern void auxSolidCone(GLdouble, GLdouble);
  293. extern void auxWireTeapot(GLdouble);
  294. extern void auxSolidTeapot(GLdouble);
  295.  
  296.  
  297. #ifdef __cplusplus
  298. }
  299. #endif
  300.  
  301.  
  302. #endif /* AUX_INCLUDED */
  303.